package sample.testListView
{
	import org.abc.uiCore.vo.CpVo;
	import org.abc.uiCore.list.ListModel;
	import org.abc.uiCore.vo.ListVo;
	import org.abc.uiCore.list.TileView;
	import org.abc.interfaces.IListView;
	import com.bit101.components.PushButton;
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import sample.ItemCP_CPS;

	/**
	 * @describe  	...
	 * @author  	Mr.zheng
	 * @website 	http://blog.sina.com.cn/zihua2007
	 * @time		2011-8-18 23:30
	 */
	public class TestListView extends Sprite
	{
		private var listView:IListView;
		private var model:ListModel;

		public function TestListView()
		{
			model=new ListModel();
			var vo:CpVo;
			for (var i:int=0; i < 2; i++)
			{
				vo=new CpVo();
				vo.data["id"]=100 + i;
				model.append(vo);
			}
			listView=new TileView();
			var listVo:ListVo=new ListVo();
			listVo.CP=ItemCP_CPS;
			listVo.model=model;
			listVo.row=5;
			listVo.col=6;
			listView.setParams(listVo);
			this.addChild(listView as DisplayObject);

			var nextPage:PushButton=new PushButton(this, 100, 100, "nextPage", onNextPage);
			var prePage:PushButton=new PushButton(this, 10, 100, "prePage", onPrePage);

			var addNode:PushButton=new PushButton(this, 10, 130, "addNode", onAddNode);
			var delNode:PushButton=new PushButton(this, 110, 130, "delNode", onDelNode);
		}

		private function onNextPage(e:MouseEvent):void
		{
			listView.nextPage();
		}

		private function onPrePage(e:MouseEvent):void
		{
			listView.prePage();
		}

		private function onAddNode(e:MouseEvent):void
		{
			var vo:CpVo=new CpVo();
			vo.data["id"]="add";
			model.append(vo);
		}

		private function onDelNode(e:MouseEvent):void
		{
			model.removeTail();
		}
	/* public function */

	/* override function */

	/* private function */
	}

}
